"use strict";
cc._RF.push(module, '293f6pZQE9Hq48LvVmRdvWZ', 'GoldColider');
// Script/colider/GoldColider.ts

Object.defineProperty(exports, "__esModule", { value: true });
var Constant_1 = require("../constant/Constant");
var NumberShow_1 = require("../number/NumberShow");
// Learn TypeScript:
//  - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/typescript.html
//  - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
//  - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
//  - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/life-cycle-callbacks.html
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var NewClass = /** @class */ (function (_super) {
    __extends(NewClass, _super);
    function NewClass() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.addScore = null;
        return _this;
    }
    NewClass.prototype.start = function () {
        this.addScore = cc.find("Canvas/Score/ScoLayer");
    };
    NewClass.prototype.onCollisionEnter = function (other) {
        var otherNode = other.node;
        var t = this;
        if (otherNode.name == "Left" || otherNode.name == "Right") {
            Constant_1.Constant.NOW_SCORE += 3;
            t.addScore.getComponent(NumberShow_1.default).showNumber(Constant_1.Constant.NOW_SCORE);
            this.node.active = false;
            this.node.position = new cc.Vec2(0, 0);
        }
    };
    NewClass.prototype.update = function (dt) {
        if (this.node.y < -Constant_1.Constant.SCREEN.height) {
            this.node.active = false;
            this.node.position = new cc.Vec2(0, 0);
        }
        else {
            var action = cc.moveBy(dt, new cc.Vec2(0, -Constant_1.Constant.GAME_SPEED));
            this.node.runAction(action);
        }
    };
    NewClass = __decorate([
        ccclass
    ], NewClass);
    return NewClass;
}(cc.Component));
exports.default = NewClass;

cc._RF.pop();